<?php
core::run();

class core
{
    public static function run()
    {
        self::init();
        $rm = $_SERVER["REQUEST_METHOD"];
        $path=str_replace("/","",getPath())?:"index";
        if ($rm == "GET") {
            if ($a = @call_user_func("get::$path")){
                if ($a!=="ignore_script") {
                    echo "<noscript><div style='position: fixed;top: 0;left: 0;background-color: white;width: 100vw;height: 100vh;font-size: 40px;line-height: 100vh;text-align: center;font-weight: bolder;z-index: 9999;'>当前浏览器不支持加载当前网页，请更换浏览器。</div></noscript>";
                }
            }else{
                http_response_code(404);
                loadErrorPage("404 Not Found","找不到您要访问的页面，请检查您访问的URL。");
            }
        } elseif ($rm == "POST") {
            if (!@call_user_func("post::$path")){
                http_response_code(404);
            }
        }
    }

    private static function init()
    {
        @self::loadClass();
        date_default_timezone_set("PRC");
        //init data
        if (($__a="a")===($__b="b"))__e::__a();
    }

    private static function loadClass()
    {
        $a = scandir("src/core");
        foreach ($a as $item) {
            if ($item != "." && $item != ".." && $item != "core.php") {
                include "src/core/" . $item;
            }
        }
    }


}
